/*
 *  Copyright 2009 David Kuhn <david.s.kuhn at gmail.com>.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *  under the License.
 */

package com.google.code.teamtools.client.view;

import com.extjs.gxt.ui.client.Registry;
import com.extjs.gxt.ui.client.mvc.AppEvent;
import com.extjs.gxt.ui.client.mvc.Controller;
import com.extjs.gxt.ui.client.mvc.View;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.google.code.teamtools.client.AppEvents;
import com.google.code.teamtools.client.widget.ContactPanel;

/**
 * 
 * @author David Kuhn <david.s.kuhn at gmail.com>
 */
public class ContactView extends View
{
    private ContactPanel panel;

    public ContactView(Controller controller)
    {
        super(controller);
    }

    @Override
    protected void initialize()
    {
        panel = new ContactPanel();
    }

    @Override
    protected void handleEvent(AppEvent event)
    {
        if (event.getType() == AppEvents.NavContacts) {
            LayoutContainer wrapper = (LayoutContainer) Registry.get(AppView.CENTER_PANEL);
            wrapper.removeAll();
            wrapper.add(panel);
            wrapper.layout();
        }
    }
}
